/*******************************************************************
 * Copyright (C) yel_hb-USTC, 2012                                
 *                                                                  
 * FILE NAME             :  kmeans.h                                 
 * PRINCIPAL AUTHOR      :  yel_hb                               
 * MODULE NAME           :  KMEANS                             
 * LANGUAGE              :  C++                                      
 * TARGET ENVIRONMENT    :  windows                                   
 * DATE OF FIRST RELEASE :  2012/12/21                              
 * DESCRIPTION           :  class KMeans definition
 ******************************************************************/

/*
 * Revision log:
 *
 * Created by yel_hb,2012/12/21
 *
 */

#ifndef KMEANS_H     
#define KMEANS_H    1

#include <vector>
#include "dmvector.h"
using namespace std;

class KMeans
{
public:
	KMeans();
	KMeans ( int k );
	int clusterize ( vector<DMVector> vlist );
	int get_point_id ( int i );
	void init_cluster_center ( vector<DMVector> vlist );
	void kmpp_init ( vector<DMVector> vlist );
	DMVector get_cluster_center ( int i );
	double DI ( vector<DMVector> vlist );
	double DBI ( vector<DMVector> vlist );
	~KMeans();
private:
	int get_closest_center_id ( const DMVector& x );
	int get_closest_center_id ( const DMVector& x, int size );
	void init_point_indexes();
	vector<DMVector> cluster_centers;
	vector<int> point_ids;
	int k;
};

#endif